/*
  Copyright 1996-2003
  Simon Whiteside

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
    License as published by the Free Software Foundation; either
    version 2 of the License, or (at your option) any later version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

  $Id: HelloScreen.java,v 1.3 2003/05/06 14:26:07 simkin_cvs Exp $
*/
package simkin.examples.helloworld_midp;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import simkin.TraceCallback;

/**
 * This class shows a screen which catches Trace output from the Simkin interpreter and puts it into a list box
 */
public class HelloScreen extends List implements CommandListener, TraceCallback {
    private final HelloWorld m_Midlet;
    private final Command m_ExitCommand;
    public HelloScreen(HelloWorld mid){
	super ("HelloWorldMIDlet",IMPLICIT);
	m_Midlet=mid;
	m_ExitCommand=new Command("Exit",Command.EXIT,1);
	addCommand(m_ExitCommand);
	setCommandListener(this);
    }
    public void trace(String msg){
        append(msg,null);
    }
    public void trace(Exception e){
        append(e.toString(),null);
    }
    public void commandAction(Command c,Displayable d){
	if (c==m_ExitCommand)
	    m_Midlet.exitRequested();
    }
}


